<?php 

/**
* 
*/
class Category extends Controller
{
	
	function __construct()
	{
		parent::__construct();
	}

	function index() {

		$this->view->list_categories = $this->model->list_view();
		$this->view->render('control/page/category',true);
	}

	public function edit_view($id){
		
		$this->view->view_edit = $this->model->edit_view($id);
		$this->view->render('control/page/category_edit',true);
	}

	public function edit_save($id){
		
		$data = array();
		$data['Id'] 	= $id;
		$data['Name'] 	= $_POST['Name'];
		$data['Path'] 	= $_POST['Path'];
		$data['Img'] 	= $_POST['Img'];

		$this->model->edit_save($data);
		header('location: '.URL.'category');
	}

	public function create(){
		$data = array();
		$data['Name'] 	= $_POST['Name'];
		$data['Path'] 	= $_POST['Path'];
		$data['Img'] 	= $_POST['Img'];

		$this->model->create($data);
		header('location: '.URL.'category');
	}

	public function delete($id) {
		$this->model->delete($id);
		header('location: '.URL.'category');
	}
}

?>